<?php
  /*
	private function _applyFilter($query)
	{
		if (is_array($this->filter))
		{
			foreach ($this->filter as $filter)
			{
				switch ($filter['type'])
				{
					case 'after':
						$date = date('Ymd', strtotime(str_replace('/', '-', $filter['value'])));
						$query->where(array($filter['field'].' >' => $date));
						break;
					case 'before':
						$date = date('Ymd', strtotime(str_replace('/', '-', $filter['value'])));
						$query->where(array($filter['field'].' <' => $date));
						break;
					case 'begins':
						$query->like($filter['field'], $filter['value'].'%', FALSE);
						break;
					case 'between':
						// First check its type because the time type needs pre-formatting
						if (preg_match('/^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9][aApP][mM]){1}$/', $filter['value']['start']) && preg_match('/^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9][aApP][mM]){1}$/', $filter['value']['end']))
						{
							$filter['value']['start'] = date('H:i', strtotime($filter['value']['start']));
							$filter['value']['end'] = date('H:i', strtotime($filter['value']['end']));
						}
						else if (preg_match('/^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$/', $filter['value']['start']) && preg_match('/^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$/', $filter['value']['end']))
						{
							$filter['value']['start'] = date('Ymd', strtotime(str_replace('/', '-', $filter['value']['start'])));
							$filter['value']['end'] = date('Ymd', strtotime(str_replace('/', '-', $filter['value']['end'])));
						}
						$query->where(array(
							$filter['field'].' >=' => $filter['value']['start'],
							$filter['field'].' <=' => $filter['value']['end']
						));
						break;
					case 'ends':
						$query->like($filter['field'], '%'.$filter['value'], FALSE);
						break;
					case 'equals':
						$query->where($filter['field'], $filter['value']);
						break;
					case 'greater':
						$query->where(array($filter['field'].' >' => $filter['value']));
						break;
					case 'less':
						$query->where(array($filter['field'].' <' => $filter['value']));
						break;
					case 'like':
						$query->like($filter['field'], $filter['value']);
						break;
					case 'notequals':
						$query->where(array($filter['field'].' !=' => $filter['value']));
						break;
					case 'notlike':
						$query->notlike($filter['field'], $filter['value']);
						break;
				}
			}
		}
	}
*/
?>